package com.dthunder.util;

import java.beans.Statement;
import java.sql.Connection;
import java.sql.SQLException;

public class User {

	public boolean insertUser(String userName,String password) {
		Connection conn=new DbConnection().getConnection();
		String sql="insert into db2inst1.shopcart_user(username,password) values('"+userName+"','"+password+"')";
		java.sql.Statement stmt;
		boolean a=false;
		try {
			stmt = (java.sql.Statement) conn.createStatement();
			
			try {
				stmt.execute(sql);
				System.out.println("ok");
				a=true;
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return a;
		
	}
	
 
	
	
	
	
	
	public static void main(String[] args) {
		new User().insertUser("sang","sang");
		
		
	}
	
}
